package com.example.librarymanagement.vo;

import com.example.librarymanagement.util.DateFormatUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * @author LQS
 */
@Data
@Accessors(chain = true)
public class BorrowRecordVo {

    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "借阅者姓名")
    private String readerName;

    @ApiModelProperty(value = "借书日期")
    private String borrowDate;

    @ApiModelProperty(value = "应还书日期")
    private String shouldReturnDate;

    @ApiModelProperty(value = "还书日期")
    private String returnDate;

    @ApiModelProperty(value = "借阅状态")
    private Integer state;

    @ApiModelProperty(value = "图书ISBN码或期刊ISSN码")
    private String bookCode;

    @ApiModelProperty(value = "图书或期刊名称")
    private String name;

    @ApiModelProperty(value = "期数")
    private String issue;

    @ApiModelProperty(value = "类型名称")
    private String typeName;

    public void setBorrowDate(Date borrowDate) {
        if (borrowDate != null) {
            this.borrowDate = DateFormatUtil.convertDateToString(borrowDate);
        }
    }

    public void setShouldReturnDate(Date shouldReturnDate) {
        if (shouldReturnDate != null) {
            this.shouldReturnDate = DateFormatUtil.convertDateToString(shouldReturnDate);
        }
    }

    public void setReturnDate(Date returnDate) {
        if (returnDate != null) {
            this.returnDate = DateFormatUtil.convertDateToString(returnDate);
        }
    }
}
